package com.company;

public class Movie implements Item
{
    String name;
    int year;
    String director;
    int rating;
    boolean available;



    Movie(String movieName, int movieYear, String movieDrector, int movieRating, boolean avail)
    {
        this.name = movieName;
        this.year = movieYear;
        this.director = movieDrector;
        this.rating = movieRating;
        this.available = avail;
    }
    @Override
    public boolean matchesForCheckout (String query)
    {
        return this.name.equalsIgnoreCase(query) && (this.available);

    }

    @Override
    public boolean matchesForReturn(String query)
    {
        return this.name.equalsIgnoreCase(query) &&  !(this.available);
    }

    @Override
    public void chechoutItem()
    {
        this.available = false;
    }

    @Override
    public void returnItem()
    {
        this.available = true;
    }

    @Override
    public boolean matchesForAvailable()
    {
        return this.available;
    }

    @Override
    public void print(int i)
    {
        System.out.format("%-10d",i);
        System.out.format("%-30s%-30d%-30s%-30d", this.name, this.year, this.director, this.rating);
    }
}
